from datetime import datetime
import secrets
import string
import time

from openpyxl import Workbook
from openpyxl import load_workbook
import execelUtil.commonUtil as commutils

import requests
import json

biz_type_list = []





# billno_list = getAllbilllist("FTLFTS-6043",[0,1],[])
billno_list = {
'2410H-MB14-CA03':145,
'2410H-MB15-CA03':145,
'2410H-MB16-GA02':144,
'2410H-MB17-GA02':145,
'2410H-MB5-CA03':400,
'2410H-MB6-CA03':331,
'2410H-MB7-CA03':313,
'2410H-MB8-CA03':234,
'2410H-MB9-CA03TX':437,
'2410H-S188-CA03':1240,
'2410H-S189-CA03':2057,
'2410H-S190-CA03':1742,
'2410H-YH118-GA02':388,
'2410H-YH119-GA02':350,
'2410H-YH6-GA02':350,
'2410H-YH7-GA02':350,
'2410H-YH8-GA02':368,
'2410H-YH91-GA02':350,
'2410H-YH94-GA02':348,
'2410H-YH95-GA02':320,
'2410H-YH96-GA02':416,
'2410H-YH97-GA02':355,
'2411H-G3-WDE':784,
'2411H-MB1-CA03':140,
'2411H-MB10-GA02':156,
'2411H-MB11-NJ':156,
'2411H-MB12-CA03':140,
'2411H-MB13-CA03':162,
'2411H-MB14-CA03':144,
'2411H-MB15-CA03':144,
'2411H-MB16-CA03TX':144,
'2411H-MB17-CA03TX':140,
'2411H-MB18-GA02':140,
'2411H-MB19-GA02':156,
'2411H-MB2-CA03':144,
'2411H-MB20-NJ':145,
'2411H-MB21-NJ':142,
'2411H-MB22-CA03':293,
'2411H-MB23-CA03':330,
'2411H-MB24-GA02':304,
'2411H-MB25-GA02':253,
'2411H-MB3-CA03':595,
'2411H-MB5-CA03':156,
'2411H-MB6-CA03':300,
'2411H-MB7-CA03':300,
'2411H-MB8-CA03TX':156,
'2411H-MB9-GA02':300,
'2411H-N1-FDE':1273,
'2411H-N141-GA02':767,
'2411H-N142-GA02':695,
'2411H-N143-GA02':766,
'2411H-N144-GA02':717,
'2411H-N145-GA02':556,
'2411H-N146-GA02':400,
'2411H-N17-CA03':826,
'2411H-N176-GA':874,
'2411H-N181-GA':989,
'2411H-N2-CA03':984,
'2411H-N2-GA02':567,
'2411H-N234-GA02':438,
'2411H-N235-GA02':216,
'2411H-N241-NJ':425,
'2411H-N242-NJ':425,
'2411H-N4-GA':751,
'2411H-N5-GA':485,
'2411H-N8-CA03':1200,
'2411H-Q1-WDE':480,
'2411H-Q10-WUK':670,
'2411H-Q11-WUK':590,
'2411H-Q2-WDE':782,
'2411H-Q20-GA':947,
'2411H-Q21-GA':811,
'2411H-Q22-GA':803,
'2411H-Q23-GA':1065,
'2411H-Q3-FDE':620,
'2411H-Q4-WUK':770,
'2411H-Q5-WDE':830,
'2411H-Q58-CA03':888,
'2411H-Q59-CA03':509,
'2411H-Q6-CA03':657,
'2411H-Q6-WDE':678,
'2411H-Q6-WUK':590,
'2411H-Q60-CA03':481,
'2411H-Q61-CA03':976,
'2411H-Q62-CA03':757,
'2411H-Q63-CA03':738,
'2411H-Q7-WDE':590,
'2411H-Q75-CA03':850,
'2411H-Q8-WDE':590,
'2411H-Q80-CA03TX':921,
'2411H-S10-CA03':1106,
'2411H-S101-CA03':902,
'2411H-S102-CA03':979,
'2411H-S103-CA03':530,
'2411H-S106-GA02':1118,
'2411H-S107-CA03':509,
'2411H-S108-CA03':518,
'2411H-S109-GA02':785,
'2411H-S11-WDE':1442,
'2411H-S11-WUK':1640,
'2411H-S110-CA03TX':508,
'2411H-S111-GA':591,
'2411H-S113-CA03':1530,
'2411H-S114-GA02':1650,
'2411H-S119-CA03':1221,
'2411H-S120-GA02':1371,
'2411H-S14-WUK':1554,
'2411H-S152-CA03':290,
'2411H-S153-CA03':274,
'2411H-S154-CA03TX':308,
'2411H-S155-CA03TX':268,
'2411H-S156-GA02':274,
'2411H-S157-GA02':272,
'2411H-S158-NJ':296,
'2411H-S16-FDE':1696,
'2411H-S17-FDE':1020,
'2411H-S18-FUK':1653,
'2411H-S19-FDE':1623,
'2411H-S19-FUK':1676,
'2411H-S21-FDE':1168,
'2411H-S29-CA03':1068,
'2411H-S3-FDE':1830,
'2411H-S32-CA03':1087,
'2411H-S48-GA02':423,
'2411H-S54-CA03':1160,
'2411H-S58-CA03':670,
'2411H-S9-CA03':1070,
'2411H-S97-CA03':2087,
'2411H-X4-CA03':522,
'2411H-X40-CA03':730,
'2411H-X41-CA03TX':691,
'2411H-X46-CA03':463,
'2411H-X47-CA03':453,
'2411H-X5-CA03':810,
'2411H-X6-CA03':809,
'2411H-X7-CA03TX':672,
'2411H-X9-NJ':670,
'2411H-Y105-CA03':570,
'2411H-Y106-CA03':824,
'2411H-Y110-GA02':655,
'2411H-Y115-GA02':540,
'2411H-Y116-GA02':360,
'2411H-Y117-GA02':485,
'2411H-Y118-CA02':434,
'2411H-Y123-CA03TX':437,
'2411H-Y126-CA03GA02':363,
'2411H-Y128-CA03GA02':384,
'2411H-Y129-CA03GA02':398,
'2411H-Y130-GA02':566,
'2411H-Y137-CA03TX':851,
'2411H-Y139-CA03':501,
'2411H-Y140-CA03':490,
'2411H-Y141-NJ':573,
'2411H-Y142-GA02':433,
'2411H-Y143-CA03':610,
'2411H-Y144-CA03':593,
'2411H-Y148-CA03TX':375,
'2411H-Y151-GA02':424,
'2411H-Y152-GA02':447,
'2411H-Y153-GA02':659,
'2411H-Y154-CA03':505,
'2411H-Y155-CA03GA02':188,
'2411H-Y23-CA03':480,
'2411H-Y24-CA03':180,
'2411H-Y25-CA03':189,
'2411H-Y28-CA03':405,
'2411H-Y29-CA03':285,
'2411H-Y31-CA03':152,
'2411H-Y33-CA03':258,
'2411H-Y35-CA03':546,
'2411H-Y40-CA03':635,
'2411H-Y41-CA03':769,
'2411H-Y42-CA03':674,
'2411H-Y46-CA03':764,
'2411H-Y47-CA03':1055,
'2411H-Y52-CA03':505,
'2411H-Y53-CA03':558,
'2411H-Y54-GA02':608,
'2411H-Y59-CA03':666,
'2411H-Y61-CA03':378,
'2411H-Y71-CA03':552,
'2411H-Y72-CA03':478,
'2411H-Y81-GA02':628,
'2411H-Y89-CA03':523,
'2411H-Y90-CA03':351,
'2411H-Y91-CA03':190,
'2411H-Y94-CA03':447,
'2411H-Y98-CA03':837,
'2411H-YG1-CA02':420,
'2411H-YG10-CA03TX':640,
'2411H-YG11-CA03TX':180,
'2411H-YG12-CA03TX':169,
'2411H-YG13-CA03TX':261,
'2411H-YG14-GA02':420,
'2411H-YG15-GA02':220,
'2411H-YG16-GA02':352,
'2411H-YG17-GA02':288,
'2411H-YG18-GA02':321,
'2411H-YG19-CA03GA02':586,
'2411H-YG2-CA02':220,
'2411H-YG20-NJ':406,
'2411H-YG21-NJ':320,
'2411H-YG22-NJ':175,
'2411H-YG23-NJ':280,
'2411H-YG3-CA02':295,
'2411H-YG4-CA02':710,
'2411H-YG5-CA02':520,
'2411H-YG6-CA02':350,
'2411H-YG7-CA02':166,
'2411H-YG8-CA02':270,
'2411H-YG9-CA03TX':494,
'2411H-YH3-NJ':1571,
'2411H-YH42-GA02':444,
'2411H-YH45-CA03':352,
'2411H-YH46-CA03':296,
'2411H-YH48-CA03GA02':811,
'2411H-YH50-CA03':460,
'2411H-YH51-CA03':460,
'2411H-YH52-GA02':460,
'2411H-YH53-GA02':419,
'2412H-MB1-CA03':160,
'2412H-MB10-CA03':300,
'2412H-MB11-GA02':145,
'2412H-MB12-GA02':270,
'2412H-MB13-CA03':290,
'2412H-MB14-CA03':170,
'2412H-MB15-GA02':158,
'2412H-MB16-GA02':300,
'2412H-MB2-CA03':160,
'2412H-MB3-NJ':160,
'2412H-MB4-CA03':145,
'2412H-MB5-CA03':145,
'2412H-MB6-GA02':145,
'2412H-MB7-GA02':145,
'2412H-MB8-CA03':160,
'2412H-MB9-CA03':158,
'2412H-N1-CA03':757,
'2412H-N10-CA03':401,
'2412H-N11-CA03':401,
'2412H-N12-CA03':401,
'2412H-N13-CA03':350,
'2412H-N14-CA03':350,
'2412H-N15-CA03':295,
'2412H-N16-CA03':382,
'2412H-N17-CA03':547,
'2412H-N18-CA03':348,
'2412H-N19-CA03':238,
'2412H-N2-CA03':690,
'2412H-N3-CA03':692,
'2412H-N4-CA03':724,
'2412H-N40-NJ':745,
'2412H-N41-NJ':645,
'2412H-N5-CA03':641,
'2412H-N55-FDI':992,
'2412H-N6-CA03':401,
'2412H-N67-GA02':400,
'2412H-N68-GA02':371,
'2412H-N69-GA02':307,
'2412H-N7-CA03':340,
'2412H-N70-GA02':400,
'2412H-N71-GA02':400,
'2412H-N72-GA02':360,
'2412H-N73-GA02':352,
'2412H-N74-GA02':325,
'2412H-N8-CA03':340,
'2412H-N9-CA03':323,
'2412H-Q1-WA':727,
'2412H-Q2-CA03':731,
'2412H-Q4-GA':851,
'2412H-S1-CA03':748,
'2412H-S3-GA02':843,
'2412H-Y2-FDI':336,
'2412H-Y3-CA03':465,
'2412H-Y4-CA03':486,
'2412H-YG1-CA03TX':900,
'2412H-YH1-CA03':449,
'2412H-YH2-CA03':460,
'2412H-YH3-GA02':460,
'2412H-YH4-GA02':426,
'2412H-YH5-NJ':455,
'R20230214142217001':2,
'R20230516163256001':2,
'R20230614092931001':1,
'R20230620180324001':13,
'R20230620180419001':2,
'R20230901114404011':1,
'R20230914114422013':24,
'R20231023231605036':1,
'R20231107115650001':10,
'R20231121133140013':6,
'R20231206141227027':3,
'R20231219103155005':1,
'R20240103102733003':1,
'R20240204100045001':20,
'R20240226131123003':8,
'R20240305135329003':1,
'R20240318095834005':1,
'R20240318110404009':3,
'R20240318110737010':2,
'R20240321133533008':1,
'R20240321134215009':1,
'R20240321151314029':1,
'R20240323135542003':4,
'R20240401113313002':2,
'R20240408151423015':1,
'R20240411145111015':1,
'R20240412173310057':2,
'R20240418173953052':3,
'R20240418174156053':2,
'R20240418184931055':3,
'R20240418185920057':1,
'R20240419103217004':1,
'R20240419142351011':5,
'R20240419181101037':1,
'R20240422115029003':1,
'R20240423165934031':1,
'R20240425175419024':3,
'R20240428162242032':2,
'R20240428162806033':1,
'R20240429152609022':1,
'R20240430114949006':1,
'R20240430160409015':2,
'R20240430174410021':1,
'R20240506155614015':1,
'R20240507131851010':2,
'R20240509161823034':4,
'R20240510143332010':2,
'R20240511181058020':1,
'R20240514095014001':4,
'R20240514131922009':3,
'R20240514150205014':1,
'R20240515162902025':1,
'R20240515201904044':10,
'R20240516180244031':3,
'R20240516183546034':2,
'R20240517144333018':1,
'R20240522174826029':4,
'R20240527214336044':3,
'R20240531141307008':2,
'R20240603144923019':1,
'R20240604144829008':6,
'R20240606164126039':3,
'R20240611143106019':1,
'R20240611170022038':1,
'R20240612090945002':1,
'R20240619135222017':1,
'R20240626110502005':1,
'R20240627100120004':3,
'R20240628213459036':8,
'R20240630215210001':10,
'R20240701180503047':1,
'R20240701180525048':4,
'R20240701180547049':4,
'R20240701192601057':1,
'R20240701192747058':1,
'R20240702090404002':1,
'R20240702090557003':5,
'R20240702143733012':1,
'R20240702155935019':2,
'R20240702200806032':3,
'R20240703100656003':1,
'R20240703101205005':2,
'R20240703103902008':1,
'R20240704124321010':3,
'R20240704125009012':9,
'R20240704130837015':250,
'R20240705114528016':1,
'R20240705143807024':4,
'R20240705153438026':1,
'R20240708172718033':2,
'R20240710171438033':2,
'R20240710173941039':1,
'R20240710174725040':1,
'R20240710180051041':1,
'R20240711093959003':5,
'R20240711111701014':168,
'R20240712170240022':4,
'R20240712193754029':1,
'R20240715135517019':3,
'R20240715155148023':1,
'R20240715161408025':1,
'R20240716172654032':1,
'R20240716180403039':1,
'R20240716222524048':1,
'R20240717203600036':7,
'R20240718184233030':1,
'R20240722181635050':1,
'R20240723151343026':1,
'R20240726101047008':2,
'R20240729104710014':1,
'R20240730133151031':1,
'R20240802100557006':1,
'R20240805102253011':3,
'R20240805115117021':1,
'R20240806101858005':2,
'R20240806151215031':1,
'R20240807104439011':1,
'R20240807113436016':5,
'R20240807114556019':3,
'R20240807142611031':2,
'R20240808144931036':1,
'R20240809133107010':1,
'R20240815134527013':3,
'R20240820164834034':1,
'R20240820170822039':1,
'R20240821155127022':1,
'R20240827141301023':1,
'R20240828171518033':1,
'R20240829132106019':1,
'R20240829174439035':9,
'R20240830133054013':144,
'R20240902093434003':1,
'R20240904153822018':1,
'R20240906095642012':1,
'R20240906164945045':1,
'R20240909151855029':1,
'R20240910192514042':1,
'R20240912113838022':4,
'R20240912171027035':12,
'R20240913130501007':1,
'R20240914094355007':13,
'R20240914095100008':1,
'R20240919133413025':1,
'R20240920145605017':1,
'R20240923103707005':1,
'R20240923135259013':1,
'R20240927171108020':1,
'R20240927183258031':1,
'R20240930113748012':1,
'R20241008101806009':5,
'R20241009180400052':4,
'R20241009180517053':1,
'R20241010170216028':3,
'R20241011163104026':8,
'R20241015163652026':1,
'R20241015184023042':1,
'R20241017143843023':2,
'R20241017143909024':1,
'R20241017143932025':1,
'R20241017144128026':1,
'R20241017144223028':1,
'R20241018171309041':1,
'R20241021113118005':1,
'R20241021173935033':1,
'R20241022093333004':1,
'R20241022111349016':1,
'R20241022163107024':1,
'R20241023100900004':2,
'R20241023105414007':1,
'R20241023112401009':1,
'R20241025091905003':1,
'R20241025180019024':1,
'R20241028100657006':1,
'R20241028101645011':1,
'R20241028101848013':1,
'R20241028165526045':8,
'R20241028170051046':9,
'R20241029094540001':1,
'R20241029101957003':1,
'R20241029103306006':1,
'R20241029105542008':1,
'R20241029110608009':1,
'R20241029113811010':8,
'R20241029132730013':1,
'R20241029134237015':1,
'R20241029141004016':1,
'R20241029142401017':1,
'R20241029142619019':3,
'R20241029161703024':1,
'R20241029161924025':1,
'R20241029162523026':3,
'R20241030093652005':4,
'R20241030100448007':1,
'R20241030100739008':2,
'R20241030101231009':1,
'R20241030102104010':1,
'R20241030132342021':1,
'R20241031093254001':3,
'R20241031102404007':2,
'R20241031134339011':1,
'R20241031135913016':1,
'R20241101094541005':1,
'R20241101102320010':1,
'R20241101133509013':1,
'R20241104090706001':1,
'R20241104183547039':6,
'R20241107173825037':1,
'R20241111104757011':1,
'R20241111112553014':1,
'R20241111135937020':1,
'R20241111145829024':1,
'R20241111154427030':2,
'R20241111155302031':65,
'R20241112153003025':2,
'R20241112160419026':1,
'R20241113091914002':1,
'R20241113093447003':1,
'R20241113165726036':1,
'R20241113170559038':1,
'R20241115150658015':50,
'R20241115151057016':1,
'R20241115155932018':1,
'R20241118104635004':2132,
'R20241118133235017':1,
'R20241118141711026':1,
'R20241118151004028':5,
'R20241118155521030':2,
'R20241118170804035':5,
'R20241119171059018':1,
'R20241119172108022':1,
'R20241120100250005':1,
'R20241120101207006':2,
'R20241120154141016':1,
'R20241121113747007':1,
'R20241121142112012':1,
'R20241121170706017':200,
'R20241121174416022':12,
'R20241121174642023':2,
'R20241121180838032':1,
'R20241122001000001':1,
'R20241122112815006':9,
'R20241122143152009':1,
'R20241122143229011':1,
'R20241122144629013':11,
'R20241125112704001':400,
'R20241125113816002':2,
'R20241125130625006':1,
'R20241125130915007':1,
'R20241125131453009':1,
'R20241125134958010':250,
'R20241125134958011':100,
'R20241125134958012':354,
'R20241125134958013':15,
'R20241125144520018':1,
'R20241125144654019':2,
'R20241125150543021':1,
'R20241125155128024':3,
'R20241125164238026':1,
'R20241125172654032':29,
'R20241125173816033':219,
'R20241125174537036':1,
'R20241125174557037':1,
'R20241125174614038':25,
'R20241125174628039':1,
'R20241125174711040':1,
'R20241125183104041':3,
'R20241125184145043':1,
'R20241125192732044':1,
'R20241126092023001':3,
'R20241126092253002':2,
'R20241126092300003':1,
'R20241126092439004':1,
'R20241126092614006':4,
'R20241126102754008':6,
'R20241126103543009':2,
'R20241126110152010':4,
'R20241126115258011':1,
'R20241126162810022':100,
'R20241126164313023':1,
'R20241126172517024':20,
'R20241126172517025':2615,
'R20241126172517026':6,
'R20241126172517027':5279,
'R20241126172517028':230,
'R20241126172517029':2,
'R20241126172946030':3090,
'R20241126175201031':1,
'R20241126180219032':1,
'R20241127090649001':1,
'R20241127094431002':30,
'R20241127103628003':219,
'R20241127112748004':130,
'R20241127112748005':178,
'R20241127112748006':40,
'R20241127112748007':46,
'R20241127112748008':54,
'R20241127112748009':49,
'R20241127112748010':39,
'R20241127112748011':33,
'R20241127114839012':17,
'R20241127130235013':1,
'R20241127130538015':1,
'R20241127142203016':1,
'R20241127163157017':1,
'R20241127190329018':1,
'ZPO23111400058':1,


}
print(billno_list)



# bill_nolist=[]
# bill_nolist.append("ZPO24040200531")
result = ''
def getAllresByZpo(billno_list):
    with open('checkdata-transofpurchase-采购收货在途.txt', 'w', encoding='utf-8') as filewr:
        for bill_no in billno_list:
            # inv_param_body = commutils.getApiList()[commutils.INV_OCCPY_PARA_BODY]

            # requests.post(commutils.getApiList()[commutils.INV_OCCPY_URL], json=param_body,
            #                              headers=commutils.getHeaders())
            qty = int(billno_list[bill_no])
            # print(qty)
            if bill_no.startswith("24"):
                param_body = commutils.getApiList()[commutils.HEAD_SUPPLYSTRAIGHT_LIST_PARA_BODY]
                param_body["planNo"] = bill_no
                response = requests.post(commutils.getApiList()[commutils.HEAD_SUPPLYSTRAIGHT_LIST_URL], json=param_body,
                                         headers=commutils.getHeaders())
            else:
                param_body = commutils.getApiList()[commutils.HEAD_DEPOTRESERVATION_PARA_BODY]
                param_body["reservationID"] = bill_no
                response = requests.post(commutils.getApiList()[commutils.HEAD_DEPOTRESERVATION_LIST_URL], json=param_body,
                                         headers=commutils.getHeaders())
            print(response.text)
            time.sleep(0.5)
            response_data = json.loads(response.text)
            response_records = response_data["data"]
            #直发查询
            if 'status' in response_records:
                if response_records["status"] in [0, 1] and 'countQty' in response_records and response_records["countQty"] == qty:
                    print(bill_no)
                else:
                    bill_str = bill_no + "," + (str(qty) + "\n")
                    filewr.write(bill_str)
                continue
            #预约进仓查询
            elif 'records' in response_records and len(response_records["records"]) > 0:
                if response_records["records"][0]["completeStatus"] in [0, 1] and response_records["records"][0][
                    "totalDeliveryQty"] == qty:
                    print(bill_no)
                else:
                    bill_str = bill_no + "," + (str(qty) + "\n")
                    filewr.write(bill_str)
                continue
            bill_str = bill_no + "," + (str(qty) + "\n")
            print(bill_str)
            filewr.write(bill_str)
            rec_str = json.dumps(response_records)
            # print(bill_no,qty)


getAllresByZpo(billno_list)
# 目标URL
url = ''

# 请求体数据
# data = {
#     "key1": "value1",
#     "key2": "value2"
# }

# 请求头信息


head_out = """
{
	"billNo": "2406H-Q61-NJ",
	"billStatusEnum": "FINISH",
	"billTime": "2024-05-31T13:18:43",
	"billTypeEnum": "TMS_STRAIGHT_WAREHOUSRE",
	"operationTypeEnum": "PUR_RECEIVE_IN_TRANSIT",
	"originBillNo": "ZPO24032500026",
	"skuList": [
		{
			"badHoldQty": 0,
			"badQty": 0,
			"freezeQty": 0,
			"holdQty": 0,
			"inTransitQty": 98,
			"oldSkuCode": "BFTLPT-1002",
			"platform": "10001",
			"skuCode": "BFTLPT-1002",
			"store": "10415",
			"totalQty": 0,
			"useQty": 0
		}
	],
	"warehouseCode": "01"
}

"""

#
# def init_data(rma_exampl):
#     result = {}
#     rma_exampl = json.loads(rma_exampl)
#     for data_pro in rma_exampl:
#         result[data_pro] = rma_exampl[data_pro]
#     # print(result)
#     return result
#
#
# def geneare_str(length):
#     characters = string.ascii_letters + string.digits
#     random_string = ''.join(secrets.choice(characters) for _ in range(length))
#     return random_string
#
#
# filename = "d:\\tmp\\占用差异-0513.xlsx"
# tmpfile = "d:\\tmp\\tmp.txt"
#
# content = ''
# with open(tmpfile, 'r', encoding='utf-8') as file:
#     # content = file.read()  # 一次性读取整个文件内容
#     # 或者使用以下方式逐行读取
#     for line in file:
#         content += line
#     # print(content)
#
# # df = pd.read_excel(filename)
# i = 0
# # 加载现有的Excel文件
# workbook = load_workbook(filename)
# billNo = ''
# # 选择工作表
# sheet = workbook.active
# for row in sheet.iter_rows(min_row=2, max_row=sheet.max_row, values_only=True):
#     if row[0] is None:
#         break
#     biz_type = row[1]
#     if biz_type != 'GOOD_OUT_HOLD':
#         continue
#     skuCode = row[9]
#     oldSkuCode = row[10]
#     platform = row[7]
#     store = row[8]
#     # billNo = row[19]
#     # origin_bill_no = row[18]
#     bill_time = row[15]
#     warehouse_code = row[6]
#     qty = int(row[11])
#     update_time = row[15]
#     req_exam = init_data(head_out)
#     gentime = datetime.now().strftime('%m%d%H')
#     if billNo == '':
#         billNo = gentime + geneare_str(4) + "_invfix"
#     req_exam["billNo"] = billNo
#     req_exam["remark"] = billNo
#     req_exam["originBillNo"] = billNo
#     # print(type(update_time))
#     print(update_time)
#     updateTime = datetime.fromisoformat(update_time)
#     # update_time = datetime.strftime(update_time,"%Y-%m-%d %H:%M:%S")
#     req_exam["billTime"] = updateTime.strftime("%Y-%m-%dT%H:%M:%S")
#     req_exam["warehouseCode"] = warehouse_code
#     skuList = req_exam["skuList"]
#     for sku in skuList:
#         sku["platform"] = platform
#         sku["store"] = store
#         sku["skuCode"] = skuCode
#         sku["oldSkuCode"] = oldSkuCode
#         sku["holdQty"] = qty * -1
#         sku["totalQty"] = 0
#     req_exam = json.dumps(req_exam)
#     print(req_exam)
#     # 发送POST请求
#
#     # print(response.text)
#     # 检查响应状态码
#     # if response.status_code == 200:
#     #     print("请求成功")
#     #     # 处理响应数据，这里以JSON为例
#     #     response_data = response.json()
#     #     print(response_data)
#     # else:
#     #     print(f"请求失败，状态码：{response.status_code}")
#     i += 1
#     if i > 1:
#         break
# f_tm = datetime.now().strftime('%Y-%m-%d_%H%M%S')
# print(i)
# workbook.save(f_tm +'_' +billNo+'_head_调出.xlsx')
